import axios from "axios";
// 创建axios实例
const request=axios.create({
    // baseURL:"http://localhost:8089",
    baseURL:"http://localhost:8091",
    timeout:5000
})
// 添加请求拦截
request.interceptors.request.use(function(config){
    //添加token
    config.headers.Authorization = localStorage.getItem("token");
    return config;
})

// 创建用户axios实例
const requestUserAPI=axios.create({
    // baseURL:"http://localhost:9007",
    baseURL:"http://localhost:8091",
    timeout:5000
})

// 创建站点axios实例
const requestStationAPI=axios.create({
    // baseURL:"http://localhost:9004",
    baseURL:"http://localhost:8091",
    timeout:5000
})
// 添加请求拦截
requestStationAPI.interceptors.request.use(function(config){
    //添加token
    config.headers.Authorization = +localStorage.getItem("token");
    return config;
})

// market
const requestMarketAPI=axios.create({
    // baseURL:"http://localhost:8084",
    baseURL:"http://localhost:8091",
    timeout:5000
})
// market 添加请求拦截
requestMarketAPI.interceptors.request.use(function(config){
    //添加token
    config.headers.Authorization = +localStorage.getItem("token");
    return config;
})

// market
const requestPayAPI=axios.create({
    // baseURL:"http://localhost:8084",
    baseURL:"http://localhost:8091",
    timeout:5000
})
// market 添加请求拦截
requestPayAPI.interceptors.request.use(function(config){
    //添加token
    config.headers.Authorization = +localStorage.getItem("token");
    return config;
})

export { requestStationAPI };
export { requestUserAPI };
export {requestMarketAPI };
export {requestPayAPI };
export default request;